<!doctype html>
<html>
<head>
<meta charset="utf-8">
    <title>积分记录</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">     
    <meta content="yes" name="apple-mobile-web-app-capable">     
    <meta content="black" name="apple-mobile-web-app-status-bar-style">     
    <meta content="telephone=no" name="format-detection">
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" type="text/css" href="/H5/css/sm.min.css" />
    <link rel="stylesheet" type="text/css" href="/H5/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="/H5/css/balance.css" />
</head>            
<body>
	<div class="page-group ms-controller" :controller="record">
        <div class="page page-current">
            <header class="bar bar-nav">
              	<a class="icon icon-left pull-left" href="javascript:window.history.go(-1);"></a>
              	<a class="icon icon-home pull-right" href="/H5"></a>
              	<h1 class="title">积分记录</h1>
            </header>
            <div class="content visibility infinite-scroll infinite-scroll-bottom" data-distance="100" style="padding-top: 80px;">
    			<div class="integral_balance" style="position: fixed; width: 100%; top: 2.5rem">
                	<div>积分余额</div>
                    <div style="font-size:28px;">{{@data.total_point}}</div>
                </div>
                <div class="integral_balance_first" :for="el in @list">
                	<div>
                    	<span><b style="font-size: .75rem">{{el.goods_title}}</b></span>
                        <span class="balance_first" style="font-size: 1rem" :css="{'color': el.type==1?'#ee5564':'#0C0'}">{{el.point>0?"+"+el.point:el.point}}</span>
                    </div>
                    <div>
                    	<span>{{el.type_label}}</span>
                        <span class="balance_gray">{{el.create_time}}</span>
                    </div>
                </div>
                <div :if="@more" class="infinite-scroll-preloader">
                    <div class="preloader"></div>
                </div>
			</div>
        </div>
    </div>
<script type='text/javascript' src='/H5/js/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/avalon.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/simpleStorage.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/mall.js?v=10' charset='utf-8'></script>
<script>
	var record = avalon.define({
		$id: "record",
		list: [],
        data: {},
        loading: false,
        more: false,
        page_num: 1,
        page_size: 10,
		getRecord: function( t ){
            if( record.loading ){
                return
            }
            record.loading = true;
			Mall.request( "/api/PointList", {page_num: record.page_num, page_size: record.page_size} )
				.always( function( data ){
                    if( data.error_code == 0 ){
                        record.data = data.data;
                        record.list = record.list.concat( data.data.list );
                        if( record.page_num == data.data.page_total ){
                            record.more = false;
                        }
                        else{
                            if( data.data.list.length == 0 ){
                                record.more = false;
                            }
                            else{
                                record.more = true;
                            }
                        }
                        record.page_num ++;
                    }
                    record.loading = false;
				} )
			$( ".content" ).removeClass( "visibility" )
		},
        infinite: function(){
            $(document).on('infinite', '.infinite-scroll-bottom',function() {
                if( record.more ){
                    record.getRecord();
                }
            });
            $.init();
        }
	})
    record.getRecord();
	record.infinite();
	avalon.scan( document.body )
</script>
</body>
</html>